@echo off

setlocal
set "OutputDir=%~dp0bin\publish\SampleWebView.Desktop"
set "ReleaseDir=%~dp0bin\Release"

if exist "%OutputDir%" (
    echo clean output dir ...
    rmdir /s /q "%OutputDir%"
)

CALL dotnet publish^
        -c Release^
        -v detailed^
        --self-contained^
        --runtime win-x64^
        --framework net9.0^
        --nologo^
        -p:PublishAot=true^
        -p:PublishTrimmed=true^
        -p:PublishSingleFile=false^
        -p:PublishReadyToRun=false^
        -p:DebugType=none^
        --output "%OutputDir%"^

@rem -p:PublishSingleFile=false, if true, then CppInterop.dll not work

if exist "%ReleaseDir%" (
    echo clean release dir ...
    rmdir /s /q "%ReleaseDir%"
)

endlocal
